//
// Utilities
//

%border-box {
  -moz-box-sizing: border-box;
       box-sizing: border-box;
}

%user-select-none {
  -webkit-user-select: none;
     -moz-user-select: -moz-none;
      -ms-user-select: none;
          user-select: none;
}

%hide-text {
  white-space: nowrap;
  overflow: hidden;
  text-indent: 100%;
  word-wrap: normal;
  overflow-wrap: normal;
  @extend %user-select-none;
}

%truncate-text {
  overflow: hidden;
  white-space: nowrap;
  word-wrap: normal;
  overflow-wrap: normal;
  text-overflow: ellipsis;
}

//
// Boxes
//

%box {
  background: $boxBackground;
  border: 1px solid $boxBorder;
  border-radius: 3px;
}

%heading-box {
  color: $boxHeaderColor;
  background: $boxHeaderBackground;
  border: 1px solid $boxBorder;
  border-radius: 3px;
}

%block-heading {
  line-height: 1.25rem;
  margin: 2em 0 1em;
  padding: .5em .75em;
  font-size: 1rem;
  overflow: hidden;
  @extend %heading-box;
}

%pre-heading {
  margin: 0;
  padding: .375rem .625rem;
  font-size: inherit;
  font-weight: normal;
  line-height: 1.5;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  @extend %heading-box;

  + pre {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: 0;
    margin-top: 0;
  }
}

//
// Notes
//

%note {
  margin: 1.5rem 0;
  padding: .5rem .875rem;
  background: $noteBackground;
  border: 1px solid $noteBorder;
  border-radius: 3px;
}

%label {
  margin: 0 1px;
  padding: 1px 4px 2px;
  background: $labelBackground;
  border-radius: 3px;
}

%block-label {
  display: block;
  line-height: 1.375rem;
  margin: 2em 0 1em;
  padding-left: .5em;
  padding-right: .5em;
  overflow: hidden;
  font-size: inherit;
  color: $boxHeaderColor;
  border: 1px solid $boxBorder;
  border-radius: 2px;
  @extend %label;
}

%label-yellow {
  background: $noteBackground;
  border-color: $noteBorder;
}

%note-green, %label-green {
  background: $noteGreenBackground;
  border-color: $noteGreenBorder;
}

%note-blue, %label-blue {
  background: $noteBlueBackground;
  border-color: $noteBlueBorder;
}

%note-orange, %label-orange {
  background: $noteOrangeBackground;
  border-color: $noteOrangeBorder;
}

%note-red, %label-red {
  background: $noteRedBackground;
  border-color: $noteRedBorder;
}

//
// External links
//

%external-link {
  &:after {
    display: inline-block;
    width: .5rem;
    height: .4375rem;
    margin: .125rem 0 0 .0625rem;
    vertical-align: top;
    @if $style == 'dark' {
      @extend %icon, %icon-link-white;
    } @else {
      @extend %icon, %icon-link;
    }
  }
}

%internal-link:after { content: none !important; }
